Color Setter

Design a color

Bottom window color:

The arrows to the right will let you adjust the bottom window's color by varying the amount of red, green and blue in the color. The text entry field shows the hexadecimal representation of this color.

If you wish, you can type a hex number directly into the box to set the color. Press return and the bottom window's color will update to this new color.

Use this utility to help you design colors for your documents, fonts, or links.

The JSCcolor object. This example uses the JavaScript Cookbook's custom color object. This object stores red, green, and blue values for a color, and allows you to adjust that color up and down and access the colors in either hex or decimal format. The applet uses this color to set the tint of the bottom frame's background color.


// --------------------JSCcolor Object---------------------

// JSCcolor object constructor
function JSCcolor(r, g, b)
{
    // set properties
    this.red = r
    this.green = g
    this.blue = b
    
    // set methods
    this.rawColor = rawColor
    this.hexColor = hexColor
    this.adjustColor = adjustColor
    this.adjustColors = adjustColors
    this.setColor = setColor
    this.setDecimalColor = setDecimalColor

    return this
}

// This JSCcolor object will store our current color
var myColor = new JSCcolor(0x80, 0x80, 0x80)
Copyright ©1998 by Charles River Media, All Rights Reserved